home *** CD-ROM | disk | FTP | other *** search
- class classes.misc.ShipSwitcher
- {
- var shipType;
- var x;
- var y;
- var routine;
- var whichBro;
- var tempLevel;
- var shrapType1;
- var shrapType2;
- var c = 0;
- var shipGift = false;
- var Name = "shipSwitcher";
- function ShipSwitcher(pshipType, px, py)
- {
- this.shipType = pshipType;
- this.x = px;
- this.y = py;
- if(_root.char == "broShip1" || _root.char == "broShip2")
- {
- this.routine = "shipToShip";
- }
- else
- {
- this.routine = "jetpackToShip";
- }
- this.whichBro = !(_root.char == "broShip1" || _root.char == "bro1") ? "bro2" : "bro1";
- }
- function shipToShip()
- {
- this.c = this.c + 1;
- _root.c = _root.c - 1;
- if(this.c == 1)
- {
- _root[_root.char].positionForSwitch(_root.newShipClip._x - 103);
- }
- if(this.c == 30)
- {
- _root[_root.char + "Clip"].body.gotoAndPlay("open");
- _root.newShipClip.ship.gotoAndPlay("open");
- }
- if(this.c == 52)
- {
- _root.d = _root.d + 1;
- _root.attachMovie(this.whichBro + "Switcher","jetPackBro",_root.d++);
- _root.jetPackBro._x = _root[_root.char].x + 15;
- _root.jetPackBro._y = _root[_root.char].y + 3;
- if(_root.char2 == "bro1")
- {
- _root.newShipClip.swapDepths(500050);
- _root.bro1 = new classes.bro.Bro1(-40,_root.newShipClip._y - 57);
- _root.addChar("bro1");
- _root.bro1.getInOldShipA();
- this.shipGift = true;
- _root.tempShipLevel = _root.bro2ShipLevel <= 3 ? _root.bro2ShipLevel + 3 : _root.bro2ShipLevel - 3;
- _root.tempShipVar = _root.bro2ShipVar;
- _root.tempLife = _root.bro2Life;
- }
- else if(_root.char2 == "bro2")
- {
- _root.newShipClip.swapDepths(500050);
- _root.bro2 = new classes.bro.Bro2(-40,_root.newShipClip._y - 57);
- _root.addChar("bro2");
- _root.bro2.getInOldShipA();
- this.shipGift = true;
- _root.tempShipLevel = _root.bro1ShipLevel <= 3 ? _root.bro1ShipLevel + 3 : _root.bro1ShipLevel - 3;
- _root.tempShipVar = _root.bro1ShipVar;
- _root.tempLife = _root.bro1Life;
- }
- }
- if(this.c == 55)
- {
- var _loc8_ = _root[_root.char].x;
- var _loc7_ = _root[_root.char].y;
- _root[_root.char + "Clip"]._x = _root[_root.char].x = _root[_root.char].tX = _root.newShipClip._x;
- _root[_root.char + "Clip"]._y = _root[_root.char].y = _root[_root.char].tY = _root.newShipClip._y;
- _root.newShipClip._x = _loc8_;
- _root.newShipClip._y = _loc7_;
- if(_root.char == "bro2" || _root.char == "broShip2")
- {
- _root.newShipClip.gotoAndStop("oldShip2");
- if(_root.bro2ShipVar == 1)
- {
- _root.newShipClip.shipStyles.gotoAndStop(_root.bro2ShipLevel);
- if(this.shipType != "ship3B")
- {
- _root[_root.char + "Clip"].body.shipStyles.gotoAndStop(Number(this.shipType.charAt(4)));
- }
- else
- {
- _root[_root.char + "Clip"].body.shipStyles.gotoAndStop(8);
- }
- }
- else
- {
- _root.newShipClip.shipStyles.gotoAndStop(_root.bro2ShipVar);
- _root.tempVar2 = _root.bro2ShipVar;
- _root[_root.char + "Clip"].body.shipStyles.gotoAndStop(8);
- }
- this.tempLevel = _root.bro2ShipLevel;
- }
- else
- {
- _root.newShipClip.gotoAndStop("oldShip1");
- if(_root.bro1ShipVar == 1)
- {
- _root.newShipClip.shipStyles.gotoAndStop(_root.bro1ShipLevel);
- if(this.shipType != "ship3B")
- {
- _root[_root.char + "Clip"].body.shipStyles.gotoAndStop(Number(this.shipType.charAt(4)));
- }
- else
- {
- _root[_root.char + "Clip"].body.shipStyles.gotoAndStop(8);
- }
- }
- else
- {
- _root.newShipClip.shipStyles.gotoAndStop(_root.bro1ShipVar);
- _root.tempVar2 = _root.bro1ShipVar;
- _root[_root.char + "Clip"].body.shipStyles.gotoAndStop(8);
- }
- this.tempLevel = _root.bro1ShipLevel;
- }
- _root.newShipClip.shipStyles.ship.gotoAndStop("open2");
- _root[_root.char + "Clip"].body.shipStyles.ship.gotoAndStop("open2");
- }
- if(this.c == 100)
- {
- _root.jetPackBro.removeMovieClip();
- if(!this.shipGift)
- {
- _root.newShipClip.shipStyles.ship.gotoAndPlay("close");
- }
- _root[_root.char].shipUpgrade(this.shipType);
- }
- if(this.c == 120)
- {
- _root[_root.char].control = true;
- }
- if(this.c > 120)
- {
- _root.c = _root.c + 1;
- if(!this.shipGift)
- {
- _root.newShipClip._y -= 2;
- var _loc3_ = false;
- var _loc5_ = 0;
- var _loc6_ = _root.broShots.length;
- while(_loc5_ < _loc6_)
- {
- var _loc4_ = _root.broShots[_loc5_] + "Clip";
- if(_root.newShipClip.hitTest(_root[_loc4_]))
- {
- _root.removeBroShot(_root.broShots[_loc5_]);
- _loc3_ = true;
- }
- _loc5_ = _loc5_ + 1;
- }
- _loc5_ = 0;
- _loc6_ = _root.enemyShots.length;
- while(_loc5_ < _loc6_)
- {
- _loc4_ = _root.enemyShots[_loc5_] + "Clip";
- if(_root.newShipClip.hitTest(_root[_loc4_]))
- {
- _loc3_ = true;
- }
- _loc5_ = _loc5_ + 1;
- }
- _loc5_ = 0;
- _loc6_ = _root.chars.length;
- while(_loc5_ < _loc6_)
- {
- _loc4_ = _root.chars[_loc5_] + "Clip";
- if(_root.newShipClip.hitTest(_root[_loc4_]))
- {
- _loc3_ = true;
- }
- _loc5_ = _loc5_ + 1;
- }
- if(_loc3_)
- {
- if(random(2) == 1)
- {
- _root.audio.playLevel2("broShip1X",_root.randRange(23,32));
- }
- else
- {
- _root.audio.playLevel2("broShip2X",_root.randRange(23,32));
- }
- _loc5_ = 0;
- _loc6_ = _root.randRange(5,8);
- while(_loc5_ < _loc6_)
- {
- _root.createExploA([_root.newShipClip._x + _root.newShipClip._width / 2 + _root.randRange(-50,50),_root.newShipClip._y + _root.newShipClip._height / 2 + _root.randRange(-50,50),_root.randRange(60,120),_root.randRange(75,100)]);
- _loc5_ = _loc5_ + 1;
- }
- if(this.whichBro == "bro1")
- {
- if(_root.tmpVar2 == 7)
- {
- this.shrapType1 = "broShipBlack";
- this.shrapType2 = "broShipBlackB";
- }
- else if(this.tempLevel > 3)
- {
- this.shrapType1 = "BroShip2_" + (this.tempLevel - 3);
- this.shrapType2 = "broShip2B_" + (this.tempLevel - 3);
- }
- else
- {
- this.shrapType1 = "BroShip1_" + this.tempLevel;
- this.shrapType2 = "broShip1B_" + this.tempLevel;
- }
- }
- else if(_root.tmpVar2 == 7)
- {
- this.shrapType1 = "BroShipBlack";
- this.shrapType2 = "broShipBlackB";
- }
- else if(this.tempLevel > 3)
- {
- this.shrapType1 = "BroShip1_" + (this.tempLevel - 3);
- this.shrapType2 = "broShip1B_" + (this.tempLevel - 3);
- }
- else
- {
- this.shrapType1 = "BroShip2_" + this.tempLevel;
- this.shrapType2 = "broShip2B_" + this.tempLevel;
- }
- _loc5_ = 0;
- while(_loc5_ < 5)
- {
- _root.createShrapnel([_root.newShipClip._x + _root.newShipClip._width / 2,_root.newShipClip._y + _root.newShipClip._height / 2,this.shrapType1]);
- _root.createShrapnel([_root.newShipClip._x + _root.newShipClip._width / 2,_root.newShipClip._y + _root.newShipClip._height / 2,this.shrapType2]);
- _loc5_ = _loc5_ + 1;
- }
- _root.newShipClip.removeMovieClip();
- }
- }
- }
- if(this.c > 400)
- {
- if(!this.shipGift)
- {
- _root.newShipClip.removeMovieClip();
- }
- _root.removeFX("shipSwitcher");
- }
- }
- function jetpackToShip()
- {
- this.c = this.c + 1;
- _root.c = _root.c - 1;
- if(this.c == 1)
- {
- _root[_root.char].positionForSwitch(_root.newShipClip._y - 57);
- }
- if(this.c == 20)
- {
- _root.newShipClip.swapDepths(500050);
- _root.newShipClip.ship.gotoAndPlay("open");
- }
- if(this.c == 30)
- {
- _root[_root.char].getInShip(_root.newShipClip._y + 3);
- }
- if(this.c == 38)
- {
- if(this.whichBro == "bro1")
- {
- _root.removeChar("bro1");
- _root.broShip1 = new classes.bro.BroShip1(_root.newShipClip._x,_root.newShipClip._y);
- _root.addChar("broShip1");
- _root.char = "broShip1";
- }
- else
- {
- _root.removeChar("bro2");
- _root.broShip2 = new classes.bro.BroShip2(_root.newShipClip._x,_root.newShipClip._y);
- _root.addChar("broShip2");
- _root.char = "broShip2";
- }
- _root.newShipClip.removeMovieClip();
- _root[_root.char].shipUpgrade(this.shipType);
- _root.shield.tagTeam();
- }
- if(this.c == 58)
- {
- _root[_root.char].control = true;
- _root.removeFX("shipSwitcher");
- }
- }
- function main()
- {
- this[this.routine]();
- }
- }
-